package day6;

import java.util.Scanner;

public class Companytest {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        Company a = new Company();
        while (true) {
            System.out.println("1.员工入职；2.显示员工信息；3.辞退员工；4.查看最高薪资员工；5.按薪资排序;6.查看员工薪资；7.涨薪0.退出");
            System.out.println("请选择：");
            int chosen = in.nextInt();
            switch (chosen) {
                case 1: {
                    Staff b=new Staff();
                   System.out.println("请输入新员工姓名");
                    b.name=in.next();
                     while(a.checkStaffNoRepeat(b.name)){
                         System.out.println("请输入新员工姓名");
                         b.name=in.next();
                     }
                    System.out.println("请输入新员工性别");
                    b.sex = in.next();
                    System.out.println("请输入新员工年龄");
                    b.age = in.nextInt();
                    System.out.println("请输入新员工职位");
                    b.job = in.next();
                    System.out.println("请输入新员工薪水");
                    b.salary = in.nextInt();
                    a.add(b);
                    break;
                }
                case 2: {
                    a.showinfo();
                    break;
                }
                case 3: {
                    System.out.println("请输入辞退员工姓名：");
                    String disname = in.next();
                    a.dismiss(disname);
                    break;
                }
                case 4:{
                    System.out.println("薪资最高的员工是：");
                    a.findTopSalary();
                    break;
                }
                case 5:{
                    System.out.println("新排序后的员工信息为：");
                    a.sortBySalDesc();
                    break;
                }
                case 6:{
                    a.getavg();
                    break;
                }
                case 7:{
                    System.out.println("调整工资后的员工信息为：");
                    a.incSalary();
                }
                case 0: {
                    System.out.println("结束!感谢使用！");
                    return;
                }
            }

        }
    }
}
